import { param } from 'jquery'
import ajax from './index'


// 获取自营设置
export function getSelfRecommend() {
  return ajax.get('/admin/setting/get/self_recommend')
}

// 自营设置
export function setSelfRecommend(data) {
  return ajax.post('/admin/setting/set/self_recommend', data)
}

// 账号列表
export function adminList(url) {
  return ajax.get('/admin/admin/search', url)
}

// 重置密码
export function resetAdmin(data) {
  return ajax.post('/admin/admin/reset_password', data)
}

// 修改密码
export function updateAdmin(data) {
  return ajax.post('/admin/admin/update_password', data)
}


// 营销活动分页列表
export function activityProductList(query) {
  return ajax({
    url: '/backend/marketingTool/activityProductList',
    method: 'get',
    params: query
  });
}
// 营销插件管理表分页列表
export function marketingToolPageList(query) {
  return ajax({
    url: '/backend/marketingTool/pageList',
    method: 'get',
    params: query
  });
}
// 更改营销插件状态
export function updateMarketingTool(query) {
  return ajax({
    url: '/backend/marketingTool/updateMarketingTool',
    method: 'POST',
    data: query
  });
}
// 新增营销插件管理表
export function marketingToolAdd(query) {
  return ajax({
    url: '/backend/marketingTool/add',
    method: 'POST',
    data: query
  });
}

// 满减券表分页列表
export function cashCouponPageList(query) {
  return ajax({
    url: '/backend/cashCoupon/pageList',
    method: 'get',
    params: query
  });
}
// 更新现金券表
export function cashCouponUpdate(query) {
  return ajax({
    url: '/backend/cashCoupon/update',
    method: 'POST',
    data: query
  });
}
// 详情
export function cashCouponDetail(id) {
  return ajax({
    url: `/backend/cashCoupon/detail/${id}`,
    method: 'get'
  });
}
// 删除现金券表

export function cashCouponDelete(ids) {
  return ajax({
    url: `/backend/cashCoupon/delete/${ids}`,
    method: 'get'
  });
}

//红包记录分页列表

export function redPacketsOrders(query) {
  return ajax({
    url: '/backend/redPacket/redPacketRecord/pageList',
    method: 'POST',
    data: query
  });
}
// 发送红包记录分页列表
export function sendRecord(query) {
  return ajax({
    url: '/backend/redPacket/sendRecord/pageList',
    method: 'POST',
    data: query
  });
}
// 根据红包 ID 查询领取记录
export function receiveRecord(redPacketId) {
  return ajax({
    url: `/backend/redPacket/receiveRecord/listByRedPacketId/${redPacketId}`,
    method: 'POST',
    // data: query
  });
}
// 领取红包记录分页列表
export function receiveRecordPageList(query) {
  return ajax({
    url: '/backend/redPacket/receiveRecord/pageList',
    method: 'POST',
    data: query
  });
}
